package com.example.administrator.mynotiifys;

import android.Manifest;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;

import com.blankj.utilcode.util.PermissionUtils;
import com.blankj.utilcode.util.ServiceUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.Utils;
import com.leeiidesu.permission.PermissionHelper;

/**
 * Created by Administrator on 2018/1/31.
 */

public class myApplication extends Application {
    private static Application mInstance = null;
    @Override
    public void onCreate() {
        mInstance = this;
        Utils.init(mInstance);
        try {

            boolean isgranted = false;//PermissionUtils.isGranted("enabled_notification_listeners");
//            if (!isgranted) {
//                PermissionUtils.permission("enabled_notification_listeners");
//            }
//            isgranted = PermissionUtils.isGranted("android.permission.BIND_NOTIFICATION_LISTENER_SERVICE");
//            if (!isgranted) {
//                PermissionUtils.permission("android.permission.BIND_NOTIFICATION_LISTENER_SERVICE");
//            }
//            PermissionHelper.with(this) // FragmentActivity/v4.app.Fragment/FragmentManager
//                    .permissions(Manifest.permission.CAMERA)
//                    .request();
//            final String flat = Settings.Secure.getString(getContentResolver(),
//                    "enabled_notification_listeners");
//
//            if(StringUtils.isEmpty(flat)) {
//                Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
//                startActivity(intent);
//            }
            ServiceUtils.startService(Snotiifys.class);
        }
        catch (Exception ex)
        {

        }
        super.onCreate();
    }
    public Context getContext()
    {
        return mInstance.getApplicationContext();
    }
}
